import Axios from '@/utils/request';
// ============ 交易方向相关 start ============
/**
 * 获取所有交易方向
 */
export const getAllTradeDirection = (): Promise<any> => {
    return Axios({
        url: '/direction/all',
    });
};

/**
 * 启用交易方向
 */
export const enableTradeDirection = (data: any): Promise<any> => {
    return Axios({
        url: '/direction/enable',
        method: 'post',
        data,
    });
};

/**
 * 禁用交易方向
 */
export const forbidTradeDirection = (data: any): Promise<any> => {
    return Axios({
        url: '/direction/forbid',
        method: 'post',
        data,
    });
};

/* ********* 风控引擎 ************** */

/**
 * 初始化数据引擎
 */
export function initEngine(data) {
    return Axios.post('/dataEngine/engineInit', data);
}

/**
 * 查询数据引擎状态
 */
export function engineState(operateType?: string): Promise<any> {
    return Axios({ url: '/dataEngine/engineState', method: 'post', headers: { operateType: operateType } });
    // return Axios.post('/dataEngine/engineState');
}

/**
 * 查询条目同步最新一条数据
 */
export function getLatestSyncEntryData(): Promise<any> {
    return Axios.post('/dataEngine/entrySyncData');
}

/**
 * 查询同步数据
 */
export function getSyncDataList(data): Promise<any> {
    return Axios.post('/synchronize/syncData/list', data);
}

/**
 * 查询同步明细
 */
export function getSyncDataDetailItem(data, operateType?: string): Promise<any> {
    return Axios({ url: '/synchronize/syncData/detailItem', method: 'post', data: data, headers: { operateType: operateType } });
}

/**
 * 关闭数据引擎
 */
export function engineStop(data): Promise<any> {
    return Axios.post('/dataEngine/engineStop', data);
}

/**
 * 查询权限树
 */
export function getAllMenu(): Promise<any> {
    return Axios.get('/role/menu/queryAll');
}

/**
 * 查询角色权限
 */
export function getRoleResourceList(roleCode): Promise<any> {
    return Axios.get('/role/resource/' + roleCode);
}

/**
 * 添加角色权限
 */
export function addRoleResources(data): Promise<any> {
    // return Axios.post('/role/insert/role/menuList/' + roleCode, data);
    return Axios.post('/role/insert/role/menuList', data);
}

/**
 * 获取交易日期
 */
export function getInitTradeDate(): Promise<any> {
    return Axios.get('/dict/initTradeDate');
}
